#!/bin/bash

# 重启tomat，  1.下载下shell文件，  2. 赋予可执行权限， 3. 挂起执行
# wget https://gitee.com/HuaweiCloudDeveloper/huaweicloud-solution-build-wangmarketcms/raw/master/shell/restart_tomcat.sh -O /mnt/tomcat8/bin/restart_tomcat.sh && chmod -R 777 /mnt/tomcat8/bin/restart_tomcat.sh && nohup /mnt/tomcat8/bin/restart_tomcat.sh &

# 结束tomcat
cd /mnt/tomcat8/bin/
./shutdown.sh

# 结束 root 用户 执行的所有 java 进程的命令（除了本身grep的这个之外）,免得没能成功结束tomcat
ps -ef | grep java | grep root | grep -v grep |awk '{print $2}' | xargs --no-run-if-empty kill -9

# 启动 tomcat
cd /mnt/tomcat8/bin/
./startup.sh